

function SearchProductJs() {

    var _I = this;

    this.Initialize = function (img, txt) {

        _I.Img = $(img);
        _I.Txt = $(txt);
        _I.IframeDialog = $("#pnlSearchProduct");        
        _I.IFrame = $('#iframeSearchProduct');

        _I.IframeDialog.dialog({
            height: '500',
            autoOpen: false,
            width: '600',
            modal: true            
        });

        _I.Img.click(function () {            
            _I.IframeDialog.dialog('open');
        });
    }

    this.SeleccionarValores = function () {

        var selectedValues = _I.IFrame.get(0).contentWindow.GetSelectedValues();

        // Proceso la respusta que esta separada por numerales
        if (selectedValues) {
            var splitValues = selectedValues.split('#');
        }        

        var separador = '';
        var returnValue = '';
        var splitValue = '';
        for (var i in splitValues) {
            splitValue = splitValues[i];
            if (splitValue != '') {
                returnValue += separador;
                returnValue += splitValue;
                separador = ',';
            }
        }
        // seleccionar los valores del iframe        
        _I.IframeDialog.dialog("close");

        _I.Txt.val(returnValue);

        //GetSelectedValues()
    };  
}